'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

var workModel = baseController.getBaseDocFields();
workModel.Code = {
    type: String,
    default: '',
    trim: true
};
workModel.Name = {
    type: String,
    default:'',
    trim: true
};
//上线控制
workModel.IsOnlineControl = {
    type: Boolean,
    default: false
};
//下线控制
workModel.IsOfflineControl = {
    type: Boolean,
    default: false
};
//交接区
workModel.ConnectArea = {
    type: Schema.ObjectId,
    ref: 'ConnectArea'
};
//是否完工入库点
workModel.IsCompletePoint = {
    type: Boolean,
    default: false
};
//是否质检点
workModel.IsQCpoint = {
    type: Boolean,
    default: false
};
workModel.Remark = {
    type: String,
    default:'',
    trim: true
};
workModel.IsEffective = {
    type: Boolean
};

var workSchema = new Schema(workModel);
workSchema.index({Name: 1});
workSchema.index({Code: 1}, {"unique": true});

mongoose.model('Work', workSchema, 'Work');
